﻿using Castle.MicroKernel.Registration;
using Castle.Windsor;
using DIBestPractice.Application;
using DIBestPractice.Application.Log;

namespace DIBestPractice.Tests
{
    public class TestApplicationBootstrap
    {
        public static IWindsorContainer Container { get; private set; }

        public static IWindsorContainer  RegisterComponents()
        {
            Container = ApplicationBootstrap.RegisterComponents();
            
            //replace components for testing
            RegisterComponentsForTesting();

            return Container;
        }

        private static void RegisterComponentsForTesting()
        {
            Container.Register(Component.For<ILogger>().ImplementedBy<ConsoleLogger>().Named("testing-logger").LifestyleScoped().IsDefault());
        }
    }
}